#include <iostream>
#include <string>
using namespace std;

char* stack;

void rearrange(const string& src, const string& des);
bool check(int* op, int opTop, const string& src, const string& des);
void display(int* op, int opLen);

int main()
{
    string src, des;
    while (cin >> src >> des)
    {
        cout << "[\n";
        rearrange(src, des);
        cout << "]\n";
    }
    return 0;
}

void rearrange(const string& src, const string& des)
{
    int size = src.length();
    int* op = new int[2 * size];
    stack = new char[size];

    for (int i = 0; i < size; i++)
    {
        op[i] = 0;
    }
    for (int i = size; i < 2 * size; i++)
    {
        op[i] = 1;
    }

    int opTop = 1;

    while (opTop != 0)
    {
        if (op[opTop] == 2)
        {
            op[opTop] = 0;
            op[--opTop]++;
            continue;
        }

        if (check(op, opTop, src, des))
        {
            if (opTop == 2 * size - 1)
            {
                display(op, 2 * size);
                op[--opTop]++;
            }
            else
            {
                opTop++;
            }
        }
        else
        {
            op[opTop]++;
        }
    }

    delete op;
    delete stack;
}

bool check(int* op, int opTop, const string& src, const string& des)
{
    int in_count = 0;
    int out_count = 0;
    for (int i = 0; i <= opTop; i++)
    {
        if (op[i] == 0) ++in_count;
        else ++out_count;
        if (out_count > (int)in_count)
        {
            return false;
        }
        else if (in_count > (int)src.length())
        {
            return false;
        }
    }

    if (op[opTop] == 0)
    {
        return true;
    }

    int sTop = 0;
    int srcIndex = 0;

    for (int i = 0; i <= opTop; i++)
    {
        if (op[i] == 0)
        {
            stack[sTop++] = src[srcIndex++];
        }
        else
        {
            --sTop;
        }
    }

    return stack[sTop] == des[out_count - 1];
}

void display(int* op, int opLen)
{
    for (int i = 0; i < opLen; i++)
    {
        if (op[i] == 0)
        {
            cout << "i ";
        }
        else
        {
            cout << "o ";
        }
    }
    cout << endl;
}
